<template>
  <div class="q-pa-md">
    <t-layout
      view="lHh Lpr lFf"
      container
      style="height: 400px"
      class="shadow-2 rounded-borders"
    >
      <t-header reveal elevated>
        <t-toolbar>
          <t-btn
            flat
            round
            dense
            icon="menu"
            @click="drawerLeft = !drawerLeft"
          />

          <t-toolbar-title> <strong>Quasar</strong> Framework </t-toolbar-title>

          <t-btn
            flat
            round
            dense
            icon="menu"
            @click="drawerRight = !drawerRight"
          />
        </t-toolbar>
      </t-header>

      <t-drawer
        v-model="drawerLeft"
        :width="150"
        :breakpoint="700"
        behavior="desktop"
        bordered
        :class="$q.dark.isActive ? 'bg-grey-9' : 'bg-grey-3'"
      >
        <t-scroll-area class="fit">
          <div class="q-pa-sm">
            <div v-for="n in 50" :key="n">Drawer {{ n }} / 50</div>
          </div>
        </t-scroll-area>
      </t-drawer>

      <t-drawer
        side="right"
        v-model="drawerRight"
        bordered
        :width="150"
        :breakpoint="500"
        behavior="desktop"
        :class="$q.dark.isActive ? 'bg-grey-9' : 'bg-grey-3'"
      >
        <t-scroll-area class="fit">
          <div class="q-pa-sm">
            <div v-for="n in 50" :key="n">Drawer {{ n }} / 50</div>
          </div>
        </t-scroll-area>
      </t-drawer>

      <t-page-container>
        <t-page padding style="padding-top: 66px">
          <p v-for="n in 15" :key="n">
            Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit nihil
            praesentium molestias a adipisci, dolore vitae odit, quidem
            consequatur optio voluptates asperiores pariatur eos numquam rerum
            delectus commodi perferendis voluptate?
          </p>

          <!-- place QPageSticky at end of page -->
          <t-page-sticky expand position="top">
            <t-toolbar class="bg-accent text-white">
              <t-avatar>
                <img
                  src="https://cdn.quasar.dev/logo-v2/svg/logo-mono-white.svg"
                />
              </t-avatar>
              <t-toolbar-title> Page Title </t-toolbar-title>
            </t-toolbar>
          </t-page-sticky>
        </t-page>
      </t-page-container>
    </t-layout>
  </div>
</template>

<script>
  import { useQuasar } from '@teld/q-components';
  import { ref } from 'vue';

  export default {
    setup() {
      const $q = useQuasar();

      return {
        drawerLeft: ref($q.screen.width > 700),
        drawerRight: ref($q.screen.width > 500),
      };
    },
  };
</script>
